﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Windows.Media.Imaging;
using Microsoft.Kinect;

namespace KinectGestureRecognition.Interfaces
{
    public abstract class DepthStreamStrategy
    {
        //Todo: Implement Workingthreads for better Performance
        #region members
        private String _DepthStreamOperationName;
        private DepthImageFrame _DepthImageFrame;
        public BitmapSource bitmapSource;
        #endregion

        #region Properties
        public DepthImageFrame DepthFrame
        {
            get
            {
                return _DepthImageFrame;
            }
            set
            {
                if (_DepthImageFrame != null)
                {
                    _DepthImageFrame = value;
                   // this.PerformDepthStreamOperation();
                }
            }
        }
        public String DepthStreamOperationName
        {
            get { return _DepthStreamOperationName; }
        }
        #endregion

        #region Methods
        public abstract void PerformDepthStreamOperation(object sender, DepthImageFrame depthImageFrame);
        #endregion

        #region Delegates
        public delegate void DepthStreamOperationEvent(object sender);
        public event DepthStreamOperationEvent OnDepthStreamOperation;
        public void ThrowOnDepthStreamOperationEvent()
        {

            if (OnDepthStreamOperation != null)
            {
                OnDepthStreamOperation(this);
            }
        }
        #endregion

        #region Constructor
        protected DepthStreamStrategy(String DepthStreamOperationName)
        {
            this._DepthStreamOperationName = DepthStreamOperationName;
            Debug.WriteLine("DepthStreamOperation loaded: " + DepthStreamOperationName);
        }
        #endregion  
    }
}
